﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php

include("inc/joomlaInt.php");
include("inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{	

// Alle bisher gespielten Teams anzeigen

	$abfrage = "SELECT c.id,t.name,t.id AS tid,t.rating,c.joinDate,c.lastMatchDate AS lmd, c.active FROM $tbl_combinations c, $tbl_teams t WHERE c.userId=$jUser
				AND c.teamId=t.id
				ORDER BY
					active DESC, joinDate DESC";
	$ergebnis = mysql_query($abfrage);

	echo "<table rules='rows' id='tabelle'>
			<thead>";
	
		echo"	<tr id='tabelle'>
					<th>Team</th>
					<th>Amtsantritt</th>
					<th>Letztes Spiel</th>
				</tr>
			</thead>
			<tbody>";
		
		
	while ($row = mysql_fetch_object($ergebnis))
	{	
		$lmd=$row->lmd;
		$ac=$row->active;
		
		if ($ac==0)
		{
			$class="inactive";
		}
		else
		{
			$class="active";
		}
		
		
		
		$jdd = $row->joinDate;
		$jd = date("d.m.Y - H:i",$jdd);
		
		
		
		if ($lmd==0)
		{
			$ld=" - ";
		}
		else
		{
			$ld = date("d.m.Y - H:i",$lmd);
		}
		
		$tname=$row->name;
		$tid=$row->tid;
		
		echo"<tr class='",$class,"'><td><a class='tooltip'><img src='img/logos/$tid.png' width='35' height='35'><span>$tname</span></a></td>";
		echo"<td>",$jd,"</td>";
		echo"<td>",$ld,"</td></tr>";
	}
	echo"</tbody></table>";
	
	echo "<br><br>
			<center><a href='lima.php' class='button zurueck'>Zurück</a></center>";
}
?>

</body>
</html>